//
//  FWCStateView.swift
//  微博项目001
//
//  Created by 樊武超 on 16/4/13.
//  Copyright © 2016年 樊武超. All rights reserved.
//

import UIKit
import SnapKit
import SDWebImage
class FWCStateView: UIView {
    var states: FWCHomeDataModel?{
        didSet{
        contextLable.text=states?.text
        }
    
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func setUpUI(){
        //加载微博头像
        addSubview(iconImageView)
        iconImageView.snp_makeConstraints { (make) -> Void in
           make.top.equalTo(self.snp_top).offset(8)
            make.left.equalTo(self.snp_left).offset(8)
            make.size.equalTo(CGSizeMake(40, 40))
        }
        //加载微博名字
        addSubview(nameLable)
        nameLable.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(iconImageView.snp_top)
            make.left.equalTo(iconImageView.snp_right).offset(8.0)
        }
        //加载时间
        addSubview(timeLable)
        timeLable.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(iconImageView.snp_right).offset(8.0)
            make.bottom.equalTo(iconImageView.snp_bottom)
        }
        //加载辅助信息
        addSubview(detalLable)
        detalLable.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(timeLable.snp_right).offset(8.0)
            make.bottom.equalTo(timeLable.snp_bottom)
        }
        //加载正文内容
        addSubview(contextLable)
        contextLable.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(iconImageView.snp_left)
            make.top.equalTo(iconImageView.snp_bottom).offset(8.0)
            make.right.equalTo(self.snp_right).offset(-8.0)
        }
    }
    lazy var iconImageView: UIImageView = UIImageView(image: UIImage(named: "avatar_default_big"))
    lazy var nameLable: UILabel = UILabel(text: "宋慧乔", fontSize: 15.0, color: UIColor.darkGrayColor())
    lazy var timeLable: UILabel = UILabel(text: "10:30", fontSize: 12.0, color: UIColor.orangeColor())
    lazy var detalLable: UILabel = UILabel(text: "隔壁老王", fontSize: 12.0, color: UIColor.darkGrayColor())
    lazy var contextLable: UILabel = UILabel(text: "宋慧乔真漂亮", fontSize: 15.0, color: UIColor.darkGrayColor(),type: .Left)
}
